import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';

@Injectable({
  providedIn: 'root'
})
export class sellCouponbagManageService {

  serviceUrls = {
    couponBagUrl: '/couponPackage/list', // 优惠券包list--URL
    nanualReleaseUrl: '/couponPackage/grantCouponPackage', // 手动发放
    editCouponUrl: '/couponPackage/update', // 删除优惠券包
    addChangeCodeUrl: '/couponExchange/add' // 增发兑换码
  };

  constructor(public httpClient: HttpClient) { }

  /**
   * 优惠券包管理tabledata
   * @param params 
   * @returns 
   */
  couponBagTableData(params: any) {
    return this.httpClient.post(this.serviceUrls.couponBagUrl, params).toPromise();
  }

  /**
   * 手动发放券包
   * @param params 
   * @returns 
   */
  nanualReleaseData(params: any) {
    return this.httpClient.post(this.serviceUrls.nanualReleaseUrl, params).toPromise();
  }

  /**
   * (修改 || 删除)优惠券包
   * @param params 
   * @returns 
   */
  editCouponData(params: any) {
    return this.httpClient.post(this.serviceUrls.editCouponUrl, params).toPromise();
  }

  // 增发兑换码
  addChangeCodeData(params: any) {
    return this.httpClient.post(this.serviceUrls.addChangeCodeUrl, params, { responseType: 'blob' }).toPromise();
  }
}



